<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateSpotPairsTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up()
    {
        Schema::create('trading_spot_pairs', function (Blueprint $table) {
            $table->increments('id')->comment('交易对ID');
            $table->string('symbol')->comment('交易对代码');
            $table->unsignedTinyInteger('status')->comment('状态: 0:未开启交易 1:交易中 2:暂停交易 3:关闭交易');
            $table->string('coin_name')->comment('币种名称');
            $table->unsignedInteger('coin_id')->comment('币种ID');
            $table->unsignedTinyInteger('coin_decimals')->comment('币种小数位');
            $table->string('market_name')->comment('交易区名称');
            $table->unsignedInteger('market_id')->comment('交易区ID');
            $table->unsignedTinyInteger('market_decimals')->comment('交易区小数位');
            $table->unsignedDecimal('price_step', 20, 8)->comment('价格步长');
            $table->unsignedDecimal('number_min', 20, 8)->comment('最小数量');
            $table->unsignedDecimal('number_step', 20, 8)->comment('数量步长');
            $table->unsignedDecimal('total_min', 20, 8)->comment('总计最小');
            $table->unsignedDecimal('buy_fee', 20, 8)->comment('买单手续费');
            $table->unsignedDecimal('sell_fee', 20, 8)->comment('卖单手续费');
            $table->unsignedTinyInteger('is_recommend')->default(0)->comment('是否首页推荐位显示 0:不显示 1:显示');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down()
    {
        Schema::dropIfExists('trading_spot_pairs');
    }
}
